home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 594 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.6 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: Shalom Reich <sqr1874@acf4.nyu.edu>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Generic Object Callbacks
  5. Date: 29 Feb 1996 16:34:30 GMT
  6. Organization: Bankers Trust Company
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <3135C73D.5570@acf4.nyu.edu>
  9. References: <pgpmoose.199602221531.14635@isolde.mti.sgi.com> <4gsi2p$905@bcarh8ab.bnr.ca> <4guh9e$jt6@sdaw04.seinf.abb.se> <4h1pb6$n19@news2.cais.com>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset="us-ascii"
  13. Content-Transfer-Encoding: 7bit
  14. X-Nntp-Posting-Host: algsvw0058.btco.com
  15. X-Mailer: Mozilla 2.0GoldB1 (WinNT; I)
  16. X-Lines: 37
  17. Content-Length: 1621
  18. Originator: clamage@taumet
  19.  
  20. Ben Jones wrote:
  21. > Anders Lindback (alindbac@sw.seisy.abb.se) wrote:
  22. > : In article <4gsi2p$905@bcarh8ab.bnr.ca>,
  23. > : brian (b.c.) white <bcwhite@bnr.ca> wrote:
  24. > : >
  25. > : >>What is needed is the ability to use member functions as callbacks
  26. > : >>without any constraint on the type of the object they are invoked on.
  27. > : >>This is possible in C++ only by using various implementation-dependent
  28. > : >>hacks to escape the type system, because the language does not provide
  29. > : >>any way to express such a construct.
  30. > : >
  31. > The point we have been making is that there is a trivial way to extend
  32. > the C++ language to provide for completely typesafe callbacks which
  33. > are simple to use and which will dramatically improve the clarity
  34. > of programs.
  35.  
  36. I don't seem to understand the discussion in this thread.  Yet it seems to generate 
  37. some strong opinions.  So, . . . 
  38.  
  39. The routine that will issue the callback (let us call it the driver) needs to use a
  40. stored pointer.  The argument is that the stored pointer should be to a member function.  
  41. Why isn't it good enough for the stored pointer to be a pointer to the object and then 
  42. the driver will only need to say "object->callback();" in order to call the proper routine.
  43. The usual virtual function semantics would take care of any inheritance hierarchy.
  44.  
  45. If the driver could deal directly with the address of a non-static member function 
  46. how would the "this" parameter be supplied by the caller?
  47.  
  48. The X example seems to be showing an inteface between a C environment and a C++
  49. environment.  Is that the real problem?
  50.  
  51. Am I missing something here?
  52.  
  53. Shalom Reich
  54.  
  55.  
  56. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your
  57.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  58.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  59.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  60.   Comments? mailto:std-c++-request@ncar.ucar.edu
  61. ]
  62.